<?php
namespace My\Controller;

use Utuo\BackgroundController;

class WechatActivityVoteOptionController extends BackgroundController
{
// 投票活动id
    private $voteId;
    // init
    public function _initialize()
    {
        $this->setControllerTitle('投票选项');
        $this->setActionTitle(array(
            'index' => '投票选项管理',
            'add' => '添加投票选项',
            'recycle' => '回收站',
            'modify' => '修改投票选项',
            'delete' => '删除投票选项',
        ));
        
        $this->setActionNav('index,add,recycle');
        
        $voteId = I('voteId',0,'intval') and session('voteId',$voteId);
        $this->voteId = session('voteId');
        $this->assign('voteId',$this->voteId);
    }
    
    
    // getList
    public function getLists($is_deleted)
    {
        $page = $this->getPage();
        $pagesize = $this->getPageSize();
        $d = D('WechatActivityVoteOption');
        $condition = array(
            'cid' => $this->aid,
            'aid' => $this->voteId,
            'is_deleted' => $is_deleted
        );
        $list = $d->where($condition)
            ->order('voteCount DESC')
            ->select();
        $this->assign('itemList', $list);
        $this->display();
    }
    
}